<?php

// Include
include_once('include/header.php');
include_once('plugin/ObrasDBPlugin.php');

// Breadcrumb
$breadcrumb = AppConfigPlugin::getBreadcrumb(basename($_SERVER['PHP_SELF']));
$smarty->assign('breadcrumb', $breadcrumb);


// Ejecucion
if (isset($_POST[sendform])) {
	if (isset($_POST[action]) && ($_POST[action] == "remove")) {
		ObrasDBPlugin::remove($_POST[id]);
		CommonPlugin::setMessage("Se ha eliminado la obra");
	}
	header( 'Location: obras.php' );
	exit;	
} else {
	$obra = ObrasDBPlugin::getById($_GET[id]);
}


// Smarty call
$smarty->assign('obra', $obra);

$smarty->display('removeobra.tpl');

?>